package 赛码;

import java.util.Scanner;

public class 欧拉函数 {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b=0;
        if (a==1) {System.out.println(1);return;}
        for (int m=1;m<a;m++){
            if (function2(m,a)) b++;
        }
        System.out.println(b);
    }


    public static boolean function2(int a,int b) {//判断互斥
        int c=a>b?a:b;
        for(c = 2;c<(a>b?a:b);c++){
            if(a%c==0&&b%c==0){
                return false;
            }
        }
        return  true;
    }

    public static void function(int a,int b) {//获得公约数
        int c=a>b?a:b;
        for(;c>0;c--){
            if(a%c==0&b%c==0){
                System.out.println(c);
            }
        }
    }
}
